package com.angelasp.domain;

import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.support.JdbcUtils;


/**
 * @Author yangb
 * @Date 2022/8/14 14:09
 * @Version 1.0
 */
@Configuration
public class PgProperties {

public static PgConnection getConfigProperties(){
    PgConnection pgConnection = new PgConnection();
    try {
        java.util.Properties props = new java.util.Properties();
        props.load(JdbcUtils.class.getClassLoader().getResourceAsStream("application.properties"));
        pgConnection.setHostName(props.getProperty("postgresql.hostname"));
        pgConnection.setPort(Integer.parseInt(props.getProperty("postgresql.port")));
        pgConnection.setDataBase(props.getProperty("postgresql.database"));
        pgConnection.setSchemaList(props.getProperty("postgresql.schemaList"));
        pgConnection.setTableList(props.getProperty("postgresql.tableList"));
        pgConnection.setUsername(props.getProperty("postgresql.username"));
        pgConnection.setPassword(props.getProperty("postgresql.password"));
        pgConnection.setSlotName(props.getProperty("postgresql.slotName"));
        pgConnection.setCheckpointDataUrl(props.getProperty("flink.checkpointDataUrl"));
        pgConnection.setSavepointPath(props.getProperty("flink.execution.savepoint.path"));
        return pgConnection;
    }catch (Exception ex){
        return  null;

    }
}

}
